<template>
	<view class="content">
		<view :style="{'height': $common.headHeight() + 'px'}"></view>
		<view class="position-relative">
			<image src="../../static/352.jpg" mode="" style="width: 750rpx;height: 450rpx;"></image>
			<view class="yaosClass position-center bg_fff d-flex align-center justify-content-center">
				<!-- <text class="iconfont icon-yuechi f-s50" style="color: #6db7fe;"></text> -->
				<image src="../../static/image/logo.png" mode="" style="width: 140rpx;height: 140rpx;border-radius: 20rpx;"></image>
			</view>
		</view>
		
		<view class="m-l40 m-r40 m-t15">
			<view class="d-flex align-center justify-content-space-between p-b5" style="border-bottom: 2rpx solid #f6f6f6;">
				<text class="iconfont icon-qiye f-s20" style="color: #6db7fe;"></text>
				<!-- <picker @change="bindPickerChange" class="flex1 m-l10" :value="index" :range="array">
					<view class="d-flex align-center">
						<view class="uni-input f-s14 flex1">{{array[index]}}</view>
						<text class="iconfont icon-31xiala f-s15" style="color: #dfdfdf;"></text>
					</view>
				</picker> -->
				<view class="uni-input f-s14 flex1 m-l10">湖南巨龙商贸有限公司</view>
			</view>
			<view class="d-flex align-center m-t15 justify-content-space-between p-b5" style="border-bottom: 2rpx solid #f6f6f6;">
				<text class="iconfont icon-zhanghao f-s20 " style="color: #6db7fe;"></text>
				<input type="text" v-model="mobile" class="flex1 f-s14 m-l10" placeholder="请输入账号">
				<checkbox value="cb" @click="changeMobile" :checked="checkboxMobile" style="transform:scale(0.7);" />
			</view>
			<view class="d-flex align-center m-t15 justify-content-space-between p-b5" style="border-bottom: 2rpx solid #f6f6f6;">
				<text class="iconfont icon-mima f-s20 " style="color: #6db7fe;"></text>
				<input type="text" v-model="password" password class="flex1 f-s14 m-l10" placeholder="请输入密码">
				<checkbox value="cb" @click="changePassword" :checked="checkboxPassword" style="transform:scale(0.7);" />
			</view>
			<view class="text-right m-t10 f-s14 co_666" @tap="$common.url('/pages/login/link')">找回密码</view>
		</view>
		<view>
			<view class="d-flex align-center justify-content-center paizhao m-t15" @tap="submit">
				<view class="f-s15 co_fff f-w500">立即登录</view>
			</view>
			<view class="d-flex align-center justify-content-center paizhao bg_000 m-t15" @tap="$common.url('/pages/home/home')">
				<view class="f-s15 co_fff f-w500">离线登录</view>
			</view>
			<!-- <view class="d-flex align-center justify-content-center paizhao1 m-t10" @tap="update">
				<view class="f-s15 f-w500" style="color: rgb(75, 196, 224);">更新数据</view>
			</view> -->
		</view>
		<view class="text-center f-s14 co_999 dinbu">
			<view class="m-t14">经销商：湖南巨龙商贸有限公司</view>
			<!-- <view class="m-t8">咨询服务：073184161520</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index:0,
				// array:['长沙千里眼公司','微趣互娱公司'],
				mobile:'',
				password:'',
				checkboxMobile:true,
				checkboxPassword:true,
			}
		},
		onLoad() {
			if(this.$db.get('checkboxMobile')) {
				this.mobile = this.$db.get('checkboxMobile')
			}
			if(this.$db.get('checkboxPassword')) {
				this.password = this.$db.get('checkboxPassword')
			}
		},
		methods: {
			// 登录
			submit() {
				if(this.checkboxMobile) {
					this.$db.set('checkboxMobile',this.mobile)
				}else {
					this.$db.del('checkboxMobile')
				}
				if(this.checkboxPassword) {
					this.$db.set('checkboxPassword',this.password)
				}else {
					this.$db.del('checkboxPassword')
				}
				if(this.mobile == '') {
					return this.$common.show('请输入账号',true)
				}
				if(this.password == '') {
					return this.$common.show('请输入密码',true)
				}
				let resData = {
					user:this.mobile,
					password:this.password,
					accNum:'004'
				}
				this.$http.post('Login/Login',resData).then(res => {
					if(res.data.state) {
						this.$common.show('登录成功')
						// this.$db.set('userInfo',res.data)
						this.$db.set('token',res.data.data)
						setTimeout(() => {
							this.$common.url('/pages/home/home')
						},1000)
					}else {
						this.$common.show('账号或密码错误',true)
					}
				})
			},
			changeMobile(e) {
				this.checkboxMobile = !this.checkboxMobile
			},
			changePassword(e) {
				this.checkboxPassword = !this.checkboxPassword
			},
		}
	}
</script>

<style lang="scss">
	.yaosClass{
		margin: 0 auto;
		// margin-top: -90rpx;
		width: 140rpx;
		height: 140rpx;
		z-index: 9;
		border-radius: 50%;
		box-shadow: 0px 2rpx 8rpx 0px rgba(111, 111, 111, 0.19);
	}
	/deep/ uni-checkbox .uni-checkbox-input{
		margin-right: 0 !important;
	}
	/deep/ uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
		border-color:#d1d1d1
	}
	.paizhao{
		width: 590rpx;
		height: 74rpx;
		background: #06aef5;
		border-radius: 74rpx;
		margin: 0 auto;
	}
	.paizhao1{
		width: 590rpx;
		height: 74rpx;
		border: 2rpx solid rgb(75, 196, 224);
		border-radius: 74rpx;
		margin: 0 auto;
	}
	.dinbu{
		position: absolute;
		bottom: 40rpx;
		width: 100%;
		text-align: center;
	}
</style>